<?php
Class newYearModel extends AppModel{
	public function getNewYearActivity()
	{
		$sql = "SELECT * FROM ".$this->table("newyear_activity")." ORDER BY status ASC ";
		$result = $this->getAll($sql);
		foreach ($result as $k=>$v)
		{
			$result[$k]['tvcontinue_time'] = ($v['tvend_time']-$v['tvbegin_time'])/60;
			$result[$k]['zbcontinue_time'] = ($v['zbend_time']-$v['zbbegin_time'])/60;
		}
		return $result;
	}
	
	public function getTVZBHongbao()
	{
		//tv
		$sql="SELECT id,title FROM ".$this->table('lucky_info')." WHERE status = 1 ";
		$tvHongbao = $this->getAll($sql);
		//zb
		$sql="SELECT id,title FROM ".$this->table('zbhb_info')." WHERE status = 1 ";
		$zbHongbao = $this->getAll($sql);
		$result = array("tvHongbao"=>$tvHongbao,"zbHongbao"=>$zbHongbao);
		return $result;
	}
	
	public function getRecord(){
		$sql = "SELECT COUNT(*) FROM ".$this->table("newyear_vote")." WHERE vote =1 ";
		$result['first'] = $this->getOne($sql);
		$sql = "SELECT COUNT(*) FROM ".$this->table("newyear_vote")." WHERE vote =2 ";
		$result['second'] = $this->getOne($sql);
		return $result;
	}
}